package com.hspedu.pool;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author 谷其昊
 * @version 1.0
 * @date 2022/3/15
 * @time 21:08
 */
public class Test {
    public static void main(String[] args) {
        ExecutorService executorService = Executors.newFixedThreadPool(5);

        Runnable task = new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println("----------------------");
            }
        };

        for (int i = 0; i < 100; i++) {
            executorService.submit(task);
        }
    }
}
